<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>weiyonghua&#39;s Blog | YOUR_SUBTITLE</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="A_KEYWORD,A_KEYWORD">
    <meta name="description" content="YOUR_DESC">
<meta name="keywords" content="A_KEYWORD,A_KEYWORD">
<meta property="og:type" content="website">
<meta property="og:title" content="weiyonghua&#39;s Blog">
<meta property="og:url" content="weiyonghua's Blog/page/2/index.html">
<meta property="og:site_name" content="weiyonghua&#39;s Blog">
<meta property="og:description" content="YOUR_DESC">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="weiyonghua&#39;s Blog">
<meta name="twitter:description" content="YOUR_DESC">
    
        <link rel="alternative" href="/atom.xml" title="weiyonghua&#39;s Blog" type="application/atom+xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/css/style.css?v=1.4.9">
    <script>window.lazyScripts=[]</script>
</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">weiyonghua</h5>
          <a href="mailto:weiyonghua16@gmail.com" title="weiyonghua16@gmail.com" class="mail">weiyonghua16@gmail.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/1135831485" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="http://t.qq.com/fy1135831485" target="_blank" >
                <i class="icon icon-lg icon-weibo"></i>
                Weibo
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">weiyonghua&#39;s Blog</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header index-header">

    <div class="container fade-scale">
        <h1 class="title">weiyonghua&#39;s Blog</h1>
        <h5 class="subtitle">
            
                YOUR_SUBTITLE
            
        </h5>
    </div>

    

</header>

<div class="container body-wrap">

    <ul class="post-list">
    
        <li class="post-list-item fade">
            <article id="post-2-1-6-Consul高可用"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:20" datetime="2017-07-03T08:20:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-6-Consul高可用/">2.1.6 Consul高可用</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.6 Consul 的高可用Consul Cluster集群架构图如下：

                
                    
                    
                
                Consul
            
这边准备了三台CentOS 7的虚拟机，主机规划如下，供参考：



主机名称
IP
作...
    

        <a href="/2017/07/03/2-1-6-Consul高可用/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-5-Consul常用命令"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:20" datetime="2017-07-03T08:20:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-5-Consul常用命令/">2.1.5 Consul常用命令</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.5 Consul常用命令Consul常用命令


命令
解释
示例




agent
运行一个consul agent
consul agent -dev


join
将agent加入到consul集群
consul join IP


members
列出consul cluster集群中的members
consul members


leave
将节点移除所在集群
con...
    

        <a href="/2017/07/03/2-1-5-Consul常用命令/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-4-Consul安装与使用"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:19" datetime="2017-07-03T08:19:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-4-Consul安装与使用/">2.1.4 Consul安装与使用</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.4 Consul安装与使用准备工作一台CentOS 7 机器，输入ifconfig ，查看网卡信息如下：
1234567891011121314151617eno16777736: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500        inet 192.168.11.143  netmask 255.255...
    

        <a href="/2017/07/03/2-1-4-Consul安装与使用/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-3-Consul"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:18" datetime="2017-07-03T08:18:00.000Z"  itemprop="datePublished">2017-07-03</time>

        


        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-3-Consul/">2.1.3 Consul</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.3 ConsulConsul 是 HashiCorp 公司推出的开源工具，用于实现分布式系统的服务发现与配置。与其他分布式服务注册与发现的方案，Consul的方案更“一站式”，内置了服务注册与发现框 架、分布一致性协议实现、健康检查、Key/Value存储、多数据中心方案，不再需要依赖其他工具（比如ZooKeeper等）。使用起来也较 为简单。Consul使用Go语言编写，因此具有天...
    

        <a href="/2017/07/03/2-1-3-Consul/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-2-Eureka的高可用"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:17" datetime="2017-07-03T08:17:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-2-Eureka的高可用/">2.1.2 Eureka的高可用</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.2 Eureka的高可用按照前文对Eureka的讲解，我们即可构建出一个简单的注册中心。但此时的Eureka是单点的，不适合于生产环境，那么如何实现Eureka的高可用呢？

添加主机名：

1127.0.0.1 peer1 peer2

修改application.yml

1234567891011121314151617181920212223---spring:  profi...
    

        <a href="/2017/07/03/2-1-2-Eureka的高可用/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-1-Eureka"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:17" datetime="2017-07-03T08:17:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-1-Eureka/">2.1.1 Eureka</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1.1 Eureka准备工作
在生产环境下，我们往往会为每个应用配置一个host，使用host而非IP进行访问。为了更加贴近生产环境，以及后文Docker章节的讲解，我们首先配置一下Host

1127.0.0.1 discovery
代码示例
创建一个Maven工程（microservice-discovery-eureka），并在pom.xml中加入如下内容：

1234567891...
    

        <a href="/2017/07/03/2-1-1-Eureka/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-2-1-服务发现"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:16" datetime="2017-07-03T08:16:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/2-1-服务发现/">2.1 服务发现</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2.1 服务发现关于服务发现在微服务架构中，服务发现（Service Discovery）是关键原则之一。手动配置每个客户端或某种形式的约定是很难做的，并且很脆弱。Spring Cloud提供了多种服务发现的实现方式，例如：Eureka、Consul、Zookeeper。
Spring Cloud支持得最好的是Eureka，其次是Consul，最次是Zookeeper。

    

        <a href="/2017/07/03/2-1-服务发现/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-Spring-Cloud"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年07月03日 16:14" datetime="2017-07-03T08:14:00.000Z"  itemprop="datePublished">2017-07-03</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/springclould专栏/">springclould专栏</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/07/03/Spring-Cloud/">Spring Cloud</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        2 Spring CloudSpring Cloud 简介Spring Cloud是在Spring Boot的基础上构建的，用于简化分布式系统构建的工具集，为开发人员提供快速建立分布式系统中的一些常见的模式。

 例如：配置管理（configuration management），服务发现（service discovery），断路器（circuit breakers），智能路由（ inte...
    

        <a href="/2017/07/03/Spring-Cloud/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/springclould/">springclould</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-node-npm淘宝镜像安装"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年06月28日 15:14" datetime="2017-06-28T07:14:00.000Z"  itemprop="datePublished">2017-06-28</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/工具/">工具</a></li></ul>



        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/06/28/node-npm淘宝镜像安装/">node npm淘宝镜像安装</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        1.node 安装，从官网下载node最新安装包https://nodejs.org/en/download/        
2.安装node完成以后，使用命令安装淘宝镜像
npm install -g cnpm –registry=https://registry.npm.taobao.org

    

        <a href="/2017/06/28/node-npm淘宝镜像安装/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/node/">node</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-局域网映射之ngrok"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017年06月28日 15:00" datetime="2017-06-28T07:00:54.000Z"  itemprop="datePublished">2017-06-28</time>

        


        

    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/06/28/局域网映射之ngrok/">局域网映射之ngrok</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        #局域网映射到外网1.从官网下载最新ngrok安装包，https://ngrok.com/download2.解压并在ngrok官网注册账号3.使用命令启动1234567891011121314151617181920212223242526272829303132333435$ ngrok --helpNAME:   ngrok - tunnel local ports to public...
    

        <a href="/2017/06/28/局域网映射之ngrok/" class="post-more waves-effect waves-button">
            阅读全文...
        </a>
    </div>
    
</article>

        </li>
    
    </ul>

    
<nav id="page-nav">
    <div class="inner">
    <a class="extend prev" rel="prev" href="/">上一页</a><a class="page-number" href="/">1</a><span class="page-number current">2</span><a class="page-number" href="/page/3/">3</a><a class="page-number" href="/page/4/">4</a><a class="extend next" rel="next" href="/page/3/">下一页</a>
    </div>
</nav>


</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            <span>博客内容遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p>
            <span>Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a></span>
            <span>weiyonghua's Blog &copy; 2015 - 2017</span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=weiyonghua's Blog/page/2/&title=weiyonghua's Blog&pic=weiyonghua's Blog/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=weiyonghua's Blog/page/2/&title=weiyonghua's Blog&source=YOUR_DESC" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=weiyonghua's Blog/page/2/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=weiyonghua's Blog&url=weiyonghua's Blog/page/2/&via=weiyonghua's Blog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=weiyonghua's Blog/page/2/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };



</script>

<script src="/js/main.min.js?v=1.4.9"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="/js/search.min.js?v=1.4.9" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>


</body>
</html>
